#include "utils.au3"
#include <IE.au3>
#Include <GuiCombo.au3>

If $CmdLine[0] = 2 Then
	$hwnd = ControlGetHandle ( " -- Web Page Dialog", "", "Internet Explorer_Server1")

	$oIE = __IEControlGetObjFromHWND($hwnd)
	;ConsoleWrite($oIE.document.body.innerHTML & @LF)

	$oFrame = _IEFrameGetCollection ($oIE, 0)
	if @Error <> 0 Then
		ConsoleWrite("frame not found")
		Exit
	EndIf
	;ConsoleWrite($oFrame.document.body.innerHTML & @LF)

	$oForm = _IEFormGetCollection($oFrame, 0)
	if @Error <> 0 Then
		ConsoleWrite("form not found")
		Exit
	EndIf

	$oName = _IEFormElementGetObjByName($oForm, "in[nick]")
	if @Error <> 0 Then
		ConsoleWrite("in[nick] not found")
		Exit
	EndIf

;	ConsoleWrite($oName.value & @LF)
	$oType = _IEFormElementGetObjByName($oForm,"in[slot_id]")
	if @Error <> 0 Then
		ConsoleWrite("in[nick] not found")
		Exit
	EndIf
;	ConsoleWrite($oType.selectedIndex & @LF)

	$oName.value = $CmdLine[2]
	$oType.selectedIndex = $CmdLine[1]
	Sleep(Random(50, 150))
	$oForm.submit
Else
	MsgBox(64, "Wrong count of params", "Wrong count of params");
EndIf


